-
Notifications
You must be signed in to change notification settings - Fork 174
Handle return value of JS_ToFloat64 #891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
quickjs.c
Outdated
if (JS_ToFloat64(ctx, &d, ctx->error_stack_trace_limit) < 0) { | ||
// Ignore error since it sets d to NAN anyway. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better:
if (JS_ToFloat64(ctx, &d, ctx->error_stack_trace_limit) < 0) { | |
// Ignore error since it sets d to NAN anyway. | |
} | |
// Ignore error since it sets d to NAN anyway. | |
// coverity[check_return] | |
JS_ToFloat64(ctx, &d, ctx->error_stack_trace_limit); |
Clearer and, from what I remember from node's coverity scans, "using" the value like you do here doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that works, great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trufae how could be test this?
228596f
to
863a6bd
Compare
A quick github search suggests that is indeed the right way to silence it. Updated! |
Looks good to me |
In case an exception is thrown by |
We restore the exception right after the dance, so it will be discarded. |
Fixes: #890